Conditions | 2 |
Total Lines | 21 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
32 | |||
33 | @Post() |
||
34 | @Roles(UserRole.PHOTOGRAPHER) |
||
35 | @ApiOperation({summary: 'Create new user'}) |
||
36 | public async index(@Body() userDto: UserDTO): Promise<UserView> { |
||
37 | try { |
||
38 | const { firstName, lastName, email, password, role } = userDto; |
||
39 | |||
40 | const id = await this.commandBus.execute( |
||
41 | new CreateUserCommand( |
||
42 | firstName, |
||
43 | lastName, |
||
44 | email, |
||
45 | password, |
||
46 | role |
||
47 | ) |
||
48 | ); |
||
49 | |||
50 | return await this.queryBus.execute(new GetUserByIdQuery(id)); |
||
51 | } catch (e) { |
||
52 | throw new BadRequestException(e.message); |
||
53 | } |
||
56 |